﻿using System;

class PrimeNumbersWithEratosthenes
{
    static void Main()
    {
        const int COUNT = 10000000;
        bool[] prime = new bool[COUNT + 1];

        for (int i = 2; i <= COUNT; i++)
        {
            prime[i] = true;
        }

        for (int p = 2; p <= COUNT; p++)
        {
            if (prime[p])
            {
                // If you want to see the result uncomment the line that follows. It might take some time.
                //Console.Write("{0} ", p);

                for (int i = 2 * p; i <= COUNT; i += p)
                {
                    prime[i] = false;
                }
            }
        }
    }
}
